<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>登陆 - 今日头条(用户)</title>
    <meta th:replace="~{/head/head_include ::  title}"/>
    <link rel="stylesheet" th:href="@{/head_res/bootstrapvalidator/css/form-validation.css}">
    <script type="text/javascript" th:src="@{/head_res/bootstrapvalidator/js/form-validation.js}"></script>
    <script type="text/javascript">
        $(function()
        {
            $("#form").FormValidation({
                fields:
                    {
                        /* 邮箱 */
                        email:
                            {
                                validators: {
                                    notEmpty: {
                                        message: '邮箱不能为空'
                                    },
                                    stringLength: {
                                        min: 4,
                                        max:40,
                                        message: '邮箱的长度为在4位与40位之间'
                                    },
                                    regexp: {
                                        regexp: /^[\w-_]+@[\w-_]+\.[\w-_]+$/i,
                                        message: '邮箱不符合规则'
                                    }
                                }
                            },
                        /* 密码 */
                        password:
                            {
                                validators: {
                                    notEmpty: {
                                        message: '密码不能为空'
                                    },
                                    stringLength: {
                                        min: 4,
                                        max:40,
                                        message: '密码的长度为在4位与40位之间'
                                    }
                                }
                            },
                        /* 验证码 */
                        code:
                            {
                                validators: {
                                    notEmpty: {
                                        message: '验证码不能为空'
                                    },
                                    stringLength: {
                                        min: 4,
                                        max:4,
                                        message: '验证码的长度为在4位字符'
                                    }
                                }
                            }
                    }
            });
        });
    </script>
</head>
<body>
<meta th:replace="~{/head/head_include ::  header}"/>
<!-- 网页的主体 -->
<div class="container">
    <div class="col-md-8 col-sm-10">
        <form id="form" class="form-horizontal" method="post"
              th:action="@{/loginSubmit}">
            <input type="hidden" name="returnUrl" value="">

            <h2 class="col-sm-10 col-sm-offset-1 form-signin-heading text-center">登陆</h2>
            <div class="form-group">
                <label for="email" class="col-sm-3 control-label">邮箱</label>
                <div class="col-sm-8">
                    <input type="text" id="email" name="email" class="form-control"
                           value="" placeholder="邮箱">
                </div>
            </div>
            <div class="form-group">
                <label for="inputPassword" class="col-sm-3 control-label">密码</label>
                <div class="col-sm-8">
                    <input type="password" name="password" id="inputPassword"
                           class="form-control" placeholder="密码"/>
                </div>
            </div>
            <div class="form-group">
                <label for="email" class="col-sm-3 control-label">验证码</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <span class="input-group-addon"> <a href="#" tabindex="-1"
                                                            onclick="return refreshCode('imgCode');"> <img
                                id="imgCode"  width="100" height="35"
                                th:src="@{/common/imgCode}" title="点击刷新验证码" />
                        </a>
                        </span>
                        <input type="text" id="code" name="code" class="form-control"
                                       placeholder="验证码">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8 col-sm-offset-2">
                    <button class="btn btn-md btn-primary" type="submit">登陆</button>
                    <a th:href="@{/register}" class="btn btn-md btn-primary ml-3">注册</a>
                </div>
            </div>
        </form>
    </div>
</div>
<meta th:replace="~{/head/head_include ::  footer}"/>
</body>
</html>